package atom.core3.hessian.util;

import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;

import com.caucho.hessian.io.AbstractHessianOutput;
import com.caucho.hessian.io.Hessian2Output;



public class HessianObjectUtil
{

	//hessian2 序列化
	public static byte[] object2Hessian2Bytes(Object object)
	{
		try
		{
			ByteArrayOutputStream baos = new ByteArrayOutputStream();

			ObjectOutputStream oos = new ObjectOutputStream(baos);

			AbstractHessianOutput out = new Hessian2Output(oos);
			out.writeObject(object);
			byte[] bs = baos.toByteArray();

			return bs;
		}
		catch (Exception e)
		{
			e.printStackTrace();
			return null;
		}
	}







}
